$(function(){
	$.ajax({
		type:"POST",
		url:"http://localhost:3000/server/findAll",
		dataType:"json",
	  	success:function(x,y,z){
	  		var movie=$("#movie");
	  		var m=0;
	  		for(var n in x){
	  			if((n-0)%2==0){
	  				movie.append("<div class='container top-20'></div>");
	  				m++;
	  			}
	  			movie.children(".container:nth-of-type("+m+")").append("<div class='col-md-6 unit'>"+
		  			"<div>"+
						"<div class='img'><img src="+x[n].poster+"></div>"+
					"</div>"+
					"<div id='"+x[n]._id+"'>"+
						"<div>片名:"+x[n].title+"</div>"+
						"<div>导演:"+x[n].doctor+"</div>"+
						"<div>国家:"+x[n].country+"</div>"+
						"<div>语言:"+x[n].language+"</div>"+
						"<div>年代:"+x[n].year+"</div>"+
						"<div class='action'><button type='button' class='btn btn-primary' onclick='change()'>编辑</button></div>"+
						"<div class='action'><button type='button' class='btn btn-danger' onclick='remove()'>删除</button></div>"+
					"</div>"+
				"</div>"
				)
	  		}
	  	},
	  	error:function(jqXHR){
			console.log(jqXHR);
	  	}
	})
})